# -*- coding: utf-8 -*-

"""
游戏音乐模块
@Author: 芮芪懿 QQ1849433491
@Project->File: pygame_train -> game_sound.py
@IDE：PyCharm
@File: game_sound.py
@Datetime: 2021/7/9 21:16
"""
from game_public import *
from resource_path import *


class GameSound(object):
    """
    @Author: 芮芪懿
    @Datetime: 2021/7/9 21:22
    游戏音效类
    """

    def __init__(self):
        self.playerFireSound = load_sound_resource(PLAYER_FIRE_SOUND_PATH)
        self.playerHitedSound = load_sound_resource(PLAYER_HITED_SOUND_PATH)
        pass

    def cycle_play_bgm(self, path: str = BGM_SOUND_PATH, volume: float = 0.6, loops: int = -1):
        """
        循环播放背景音乐
        :return:
        """
        pygame.mixer.music.load(path)
        pygame.mixer.music.set_volume(volume)
        pygame.mixer.music.play(loops)
        pass
